<div class="ibox-content">
<form class="form-horizontal" id="f_add"  action="{$action_url}" method="post" >
	<div class="form-group" style="display:none">
		<label class="col-sm-3 control-label" for="name">{:L('CREATOR_ROLE')}</label>
		<div class="col-sm-6"> 
          {$Think.session.name}
		</div>
	</div>
<volist name="field_list" id="vo">
	<div class="form-group">
		<label class="col-sm-3 control-label" for="{$vo.field}">{$vo.name} <if condition="$vo['is_validate'] == 1 AND $vo['is_null'] == 1"><span class="require">*</span></if></label>
		<div class="col-sm-6"> 
          {$vo.html}
		</div>
	</div>
</volist>    
	<div class="form-group">
		<label class="col-sm-3 control-label"></label>
		<div class="col-sm-8">
       　　　<input type="hidden" name="id" value="{$id}">
			<input class="btn btn-primary" id="btn_save" type="submit" name="submit" value="{$btn_name}"/> &nbsp; 
			<input class="btn" onclick="javascript:layer.closeAll();"  type="button" value="{:L('CANCEL')}"/>
		</div>
	</div>
</form>
</div>
<script>


function showResponse(responseText,statusText) {
  if(statusText=='success'){
	  console.log(responseText);
	if (responseText.status == 1) {
		parent.layer.msg(responseText.info, {icon: 1}); //正确的图标提示
		$(".form-control").val("");
		$("#refresh_data_table").trigger("click");
		//parent.layer.closeAll();
	} else {
		parent.layer.msg(responseText.info, {icon: 2}); //错误的图标提示
	}
	
  }
}


$(function(){
	
	$('.i-checks').iCheck({
		checkboxClass: 'icheckbox_square-green',
		radioClass: 'iradio_square-green',
	});
	
	$.validator.setDefaults({
		highlight: function (element) {
			$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
		},
		success: function (element) {
			element.closest('.form-group').removeClass('has-error').addClass('has-success');
		},
		errorElement: "span",
		errorPlacement: function (error, element) {
			if (element.is(":radio") || element.is(":checkbox")) {
				error.appendTo(element.parent().parent().parent());
			} else {
				error.appendTo(element.parent());
			}
		},
		errorClass: "help-block m-b-none",
		validClass: "help-block m-b-none"


	});
	
	

   $("#f_add").validate({
        submitHandler:function(form){
 			var url = '{$action_url}';
		    ajax_do(url,$("#f_add").serialize());	

        }    
    });   
	


	

});

</script>